using System;
using System.Data.Linq;

namespace PropertyExpression.ReactiveRelation.Test.Demo
{
    partial class Quote
    {
        partial void OnCreated()
        {
            CalcExecutorHolder.CalcExecutor.RegisterEntity(this);
        }
    }

    partial class QuoteJob
    {
        partial void OnCreated()
        {
            CalcExecutorHolder.CalcExecutor.RegisterEntity(this);
        }
    }

    partial class QuotePart
    {
        partial void OnCreated()
        {
            CalcExecutorHolder.CalcExecutor.RegisterEntity(this);
        }
    }

    partial class QuoteOtherExpense
    {
        partial void OnCreated()
        {
            CalcExecutorHolder.CalcExecutor.RegisterEntity(this);
        }
    }

    partial class Dealer
    {
        partial void OnCreated()
        {
            CalcExecutorHolder.CalcExecutor.RegisterEntity(this);
        }
    }

    partial class DealerOtherExpense
    {
        partial void OnCreated()
        {
            CalcExecutorHolder.CalcExecutor.RegisterEntity(this);
        }
    }

    internal static class QuoteCalc
    {
        public static IPropertyValue<decimal> LaborSubtotal(this IPropertyHolder<Quote> it)
        {
            return it._(_ => _.LaborSubtotal);
        }

        public static IPropertyValue<decimal> PartSubtotal(this IPropertyHolder<Quote> it)
        {
            return it._(_ => _.PartSubtotal);
        }

        public static IPropertyValue<EntitySet<QuoteOtherExpense>> QuoteOtherExpenses(this IPropertyHolder<Quote> it)
        {
            return it._(_ => _.QuoteOtherExpenses);
        }

        public static IPropertyValue<EntitySet<QuoteJob>> QuoteJobs(this IPropertyHolder<Quote> it)
        {
            return it._(_ => _.QuoteJobs);
        }

        public static IPropertyValue<decimal> OtherExpenseSubtotal(this IPropertyHolder<Quote> it)
        {
            return it._(_ => _.OtherExpenseSubtotal);
        }

        public static void PartSubtotal<TCalcContext>(
            this IBinder<TCalcContext, Quote> binder,
            Func<IPropertyBindContext<TCalcContext, Quote, decimal>, IValue<decimal>> func)
        {
            binder._(_ => _.PartSubtotal)(func);
        }

        public static void LaborSubtotal<TCalcContext>(
            this IBinder<TCalcContext, Quote> binder,
            Func<IPropertyBindContext<TCalcContext, Quote, decimal>, IValue<decimal>> func)
        {
            binder._(_ => _.LaborSubtotal)(func);
        }

        public static void OtherExpenseSubtotal<TCalcContext>(
            this IBinder<TCalcContext, Quote> binder,
            Func<IPropertyBindContext<TCalcContext, Quote, decimal>, IValue<decimal>> func)
        {
            binder._(_ => _.OtherExpenseSubtotal)(func);
        }

        public static void QuoteTotal<TCalcContext>(
            this IBinder<TCalcContext, Quote> binder,
            Func<IPropertyBindContext<TCalcContext, Quote, decimal>, IValue<decimal>> func)
        {
            binder._(_ => _.QuoteTotal)(func);
        }
    }

    internal static class QuoteJobCalc
    {
        public static IPropertyValue<decimal> JobTotal(this IPropertyHolder<QuoteJob> it)
        {
            return it._(_ => _.JobTotal);
        }

        public static IPropertyValue<decimal> PartSubtotal(this IPropertyHolder<QuoteJob> it)
        {
            return it._(_ => _.PartSubtotal);
        }

        public static IPropertyValue<decimal> LaborSubtotal(this IPropertyHolder<QuoteJob> it)
        {
            return it._(_ => _.LaborSubtotal);
        }

        public static IPropertyValue<EntitySet<QuotePart>> QuoteParts(this IPropertyHolder<QuoteJob> it)
        {
            return it._(_ => _.QuoteParts);
        }

        public static IPropertyValue<decimal> LaborRate(this IPropertyHolder<QuoteJob> it)
        {
            return it._(_ => _.LaborRate);
        }

        public static IPropertyValue<decimal> LaborTime(this IPropertyHolder<QuoteJob> it)
        {
            return it._(_ => _.LaborTime);
        }

        public static void LaborSubtotal<TCalcContext>(
            this IBinder<TCalcContext, QuoteJob> binder,
            Func<IPropertyBindContext<TCalcContext, QuoteJob, decimal>, IValue<decimal>> func)
        {
            binder._(_ => _.LaborSubtotal)(func);
        }

        public static void PartSubtotal<TCalcContext>(
            this IBinder<TCalcContext, QuoteJob> binder,
            Func<IPropertyBindContext<TCalcContext, QuoteJob, decimal>, IValue<decimal>> func)
        {
            binder._(_ => _.PartSubtotal)(func);
        }

        public static void JobTotal<TCalcContext>(
            this IBinder<TCalcContext, QuoteJob> binder,
            Func<IPropertyBindContext<TCalcContext, QuoteJob, decimal>, IValue<decimal>> func)
        {
            binder._(_ => _.JobTotal)(func);
        }
    }

    internal static class QuotePartCalc
    {
        public static IPropertyValue<decimal> PartTotal(this IPropertyHolder<QuotePart> it)
        {
            return it._(_ => _.PartTotal);
        }

        public static IPropertyValue<int> Quantity(this IPropertyHolder<QuotePart> it)
        {
            return it._(_ => _.Quantity);
        }

        public static IPropertyValue<decimal> Price(this IPropertyHolder<QuotePart> it)
        {
            return it._(_ => _.Price);
        }

        public static void PartTotal<TCalcContext>(
            this IBinder<TCalcContext, QuotePart> binder,
            Func<IPropertyBindContext<TCalcContext, QuotePart, decimal>, IValue<decimal>> func)
        {
            binder._(_ => _.PartTotal)(func);
        }
    }

    internal static class QuoteOtherExpenseCalc
    {
        public static IPropertyValue<decimal> OtherExpenseTotal(this IPropertyHolder<QuoteOtherExpense> it)
        {
            return it._(_ => _.OtherExpenseTotal);
        }

        public static IPropertyValue<Quote> Quote(this IPropertyHolder<QuoteOtherExpense> it)
        {
            return it._(_ => _.Quote);
        }

        public static IPropertyValue<decimal> LaborPercent(this IPropertyHolder<QuoteOtherExpense> it)
        {
            return it._(_ => _.LaborPercent);
        }

        public static IPropertyValue<decimal> PartPercent(this IPropertyHolder<QuoteOtherExpense> it)
        {
            return it._(_ => _.PartPercent);
        }

        public static IPropertyValue<decimal> Fix(this IPropertyHolder<QuoteOtherExpense> it)
        {
            return it._(_ => _.Fix);
        }

        public static IPropertyValue<decimal> Price(this IPropertyHolder<QuoteOtherExpense> it)
        {
            return it._(_ => _.Price);
        }

        public static IPropertyValue<int> Quantity(this IPropertyHolder<QuoteOtherExpense> it)
        {
            return it._(_ => _.Quantity);
        }

        public static void OtherExpenseTotal<TCalcContext>(
            this IBinder<TCalcContext, QuoteOtherExpense> binder,
            Func<IPropertyBindContext<TCalcContext, QuoteOtherExpense, decimal>, IValue<decimal>> func)
        {
            binder._(_ => _.OtherExpenseTotal)(func);
        }

        public static void Price<TCalcContext>(
            this IBinder<TCalcContext, QuoteOtherExpense> binder,
            Func<IPropertyBindContext<TCalcContext, QuoteOtherExpense, decimal>, IValue<decimal>> func)
        {
            binder._(_ => _.Price)(func);
        }
    }
}